<?php
class AppModel extends Model {
	
    function covertArray($records,$model,$key='id',$value='name')
    {
        $data = array();
        foreach($records as $record)
        {
            $data[$record[$model][$key]] = $record[$model][$value]; 
        }
        return $data;
    }
    
    function diff($start,$end = false) {
        if(!$end) { $end = date('Y-m-d H:i:s'); }
        $d_start    = strtotime($start);
        $d_end      = strtotime($end);        
        return $d_end - $d_start;        
    } 
}
?>
